package com.haotunet.app.goldtreasure.adapter;

import java.util.List;

import com.haotunet.app.goldtreasure.R;
import com.haotunet.app.goldtreasure.model.CoinInfo;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;

public class GCoinAdapter extends HolderAdapter<CoinInfo, GCoinAdapter.ViewHolder> {

	public GCoinAdapter(Context context, List<CoinInfo> mlist) {
		super(context, mlist);
	}

	@Override
	public View buildConvertView(LayoutInflater layoutInflater, CoinInfo t, int position) {
		return inflate(R.layout.item_gcoin_get_detail);
	}

	@Override
	public ViewHolder buildHolder(View convertView, CoinInfo t, int position) {
		ViewHolder holder = new ViewHolder();
		holder.tvObtainNum = (TextView) convertView.findViewById(R.id.tv_add_coins);
		holder.tvObtainTime = (TextView) convertView.findViewById(R.id.tv_addcoin_time);
		holder.tvObtainType = (TextView) convertView.findViewById(R.id.tv_addcoin_type);
		return holder;
	}

	@Override
	public void bindViewDatas(View convertView, ViewHolder holder, CoinInfo coinInfo, int position) {
		holder.tvObtainNum.setText(coinInfo.getCoinCount());
		holder.tvObtainTime.setText(coinInfo.getCreateTime());
		holder.tvObtainType.setText(coinInfo.getTypeName());
	}

	public static class ViewHolder {
		TextView tvObtainType;
		TextView tvObtainTime;
		TextView tvObtainNum;

	}
}
